<%@ include file="IsProff.jsp"%>
<%@ page import="java.io.*, java.text.*, java.util.Date, java.sql.*, javax.servlet.*, javax.servlet.http.*, java.util.*,database.DBCon" %>
<%
try{
           DBCon db1 = new DBCon();
            int size = db1.countStudent("");

            String[] id = new String[size];
            String[] name = new String[size];
            String[] gpa = new String[size];
            

            ResultSet res = db1.getStudent(" order by gpa desc");
            for (int i = 0; res.next(); i++) {
                id[i] = res.getString("id");
                name[i] = res.getString("firstName") + " " + res.getString("lastName");
                gpa[i] = res.getString("GPA");
            }

            
            out.println("<script type='text/javascript'>");
            out.println("function init() {");
            for (int i = 0; i < size; i++) {
                out.println("descriptions[" + i + "] = new Desc();");
                out.println("descriptions[" + i + "].id = '" + (id[i] != null ? id[i] : "") + "';");
                out.println("descriptions[" + i + "].t = '" + (name[i] != null ? name[i] : "") + "';");
                out.println("descriptions[" + i + "].gpa = '" + (gpa[i] != null ? gpa[i] : "") + "';");
            }
            out.println("}");
            out.println("</script>");
%>
<%=request.getParameter("wrong") == null ? "" : "<h2 class='wrong'>Project Cannot be deleted</h2>"%>
                    <h1>By Student</h1>
					<span style="color:red;">Note: to display a project's details, <b>double click </b>on it</span><br />
					 <br />
<table style="text-align: left" border="0" width="100%" cellspacing="0" cellpadding="0" class="all">
    <%

            for (int i = 0; i < id.length; i++) {
    %>
    <tr>
        <td id="td<%=i%>" valign="top" class="normal">
            <div id="ccc<%=i%>">
            <div id="title<%=i%>" class="title" width="100%" onMouseOver="mouse(<%=i%>)" onMouseOut="mouseo(<%=i%>)" onclick="clicked(<%=i%>)">
            
            </div> 
            </div>
            
        </td>
        
    </tr>
    
    <%
            }
    }
catch(Exception e)
{
    response.sendRedirect("../connectionFailed.jsp?"+e);
}

    %>
    
</table>